<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
    <style type="text/css">
        body, html {
            width: 100%;
            height: 100%;
            margin: 0;
            font-family: "微软雅黑";
        }
        #allmap {
            height: 700px;
            width: 100%;
        }
        #r-result {
            width: 100%;
            font-size: 14px;
        }
    </style>
        <script type="text/javascript"
        src="http://api.map.baidu.com/api?v=2.0&ak=i4320FFZmDyx4uG1B5R60a7EvM4jPjXh"></script>
    <title>经纬度定位</title>
</head>
<body>
<div id="allmap"></div>
<div id="r-result">
    <input type="button" />
</div>
</body>
</html>
<script type="text/javascript">

    var map = new BMap.Map("allmap");
    map.enableScrollWheelZoom(true);
    //左上控制台
    var navigationControl = new BMap.NavigationControl({
        // 靠左上角位置
        anchor: BMAP_ANCHOR_TOP_LEFT,
        // LARGE类型
        type: BMAP_NAVIGATION_CONTROL_LARGE,
        // 启用显示定位
        enableGeolocation: true
    });
    map.addControl(navigationControl);

    //设立中心点
    var address_longitude = {{address_longitude}};
    var address_latitude = {{address_latitude}};
    var point = [];//存放标注点经纬信息的数组
    var marker = []; //存放标注点对象的数组
    map.centerAndZoom(new BMap.Point(123, 47), 18);

    // function addMarker(point){
	//   var marker = new BMap.Marker(point);
    //   map.addOverlay(marker);
    // }

    for (var i = 0; i < address_longitude.length; i++) {
            point[i] = new BMap.Point(address_longitude[i], address_latitude[i]); //循环生成新的地图点
            marker[i] = new BMap.Marker(point[i]); //按照地图点坐标生成标记
            map.addOverlay(marker[i]);
        }

    // map.centerAndZoom(new BMap.Point(address_longitude, address_latitude), 18);
    //     for (i = 0; i < marker.length; i++) {
    //         (function () {
    //             var index = i;
    //             marker[index].addEventListener('click', function () {
    //                 this.openInfoWindow(new BMap.InfoWindow(address_data[index]));
    //             });
    //         })();
    //     }
    // }
</script>